<%-- 
    Document   : tampil
    Created on : 19 Jun 11, 0:41:18
    Author     : compaq
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript">
            function hapusdata(nama){
                alert('data pasien '+nama+'berhasil dihapus');
            }
        </script>
    </head>
    <body>  
        <h2 align="center">APLIKASI PALANG MERAH INDONESIA<br>Form Input Pasien</h2>
        <form action="/ProjekPMI/ControlPasien" method="POST" align="center">
        <table width="334" border="1" align="center">
            <tr>
                <td width="125">id</td>
                <td width="193">
                    <input type="hidden" name="flag" value="tambah" />
                    <input type="text" name="id" />
              </td>
            </tr>
            <tr>
                <td>Nama</td><td><input name="nama" type="text" size="30" maxlength="30" vslue="" /></td>
            </tr>
            <tr>
                <td>Jenkel</td><td>
                    <input name="jenkel" type="radio" value="L" />
                    Laki-Laki
                    <input name="jenkel" type="radio" value="P" />
                    Perempuan
                </td>
            </tr>
            <tr>
                <td>Umur</td><td><input name="umur" type="text" size="5" maxlength="5" /></td>
            </tr>
            <tr>
                <td>Goldarah</td><td>
                    <select name="goldarah">
                      <option value="" selected="selected"  ></option>
                      <option value="A">A</option>
                      <option value="B">B</option>
                      <option value="AB">AB</option>
                      <option value="O">O</option>
                    </select>
                </form>
                </td>
            </tr>
            <tr>
                <td valign="top">Alamat</td><td><textarea name="alamat" rows="2" ></textarea></td>
            </tr>
            <tr>
                <td colspan="2" align="right"><input type="submit" name="submit" value="Enter" /></td>
            </tr>
</table>
        </form>
        <c:if test="${not empty daftarPasien}">
            <h1 align="center">DAFTAR PASIEN</h1>
            <table border="1" align="center" width="75%" ><tr bgcolor="red"><th width="25%">Nama</th>
                <th>Umur</th><th>J. Kel</th><th>Gol. Darah</th><th colspan="2">Proses</th></tr>
            <c:forEach items="${daftarPasien}" var="pasien">
                        <tr><td>${pasien.nama}</td><td>${pasien.umur}</td><td align="center">${pasien.jenkel}</td><td align="center">${pasien.goldarah}
                            </td><td align="center"><a href="ControlPasien?aksi=baca&id=${pasien.id}">ubah</a>
                            </td><td align="center"><a href="ControlPasien?aksi=hapus&id=${pasien.id}" onclick="hapusdata(${pasien.nama})">hapus</a>
                        </td></tr>
            </c:forEach>
            </table>
        </c:if>
    </body>
</html>
